package com.lesson14.observe.ex;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/10/2 14:14
 */

//具体的观察者
public class ConcreteObserver implements Observer
{
    private int state;//state对象需要和subject中的state保持一致
    @Override
    public void update(Subject subject)
    {
     this.state = ((ConcreteSubject) subject).getState();
    }

    public int getState()
    {
        return state;
    }

    public void setState(int state)
    {
        this.state = state;
    }
}
